<script lang="ts" setup>
import { ref, reactive } from 'vue'
import type { ComponentSize } from 'element-plus'
const currentPage4 = ref(4)
const pageSize4 = ref(20)
const size = ref<ComponentSize>('default')
const background = ref(false)
const disabled = ref(false)
const total = ref(20)

const handleSizeChange = (val: number) => {
    console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
    console.log(`current page: ${val}`)
}
const formInline = reactive({
    user: '',
    region: '',
    date: '',
})

const onSubmit = () => {
    console.log('submit!')
}
import {
    Delete,
    Edit,
} from '@element-plus/icons-vue'
const tableData = [
    {
        username: 'Tom',
        jods: 'Tom',
        phone: '123131231',
    },
    {
        username: 'Tom',
        jods: 'Tom',
        phone: '123131231',
    },
    {
        username: 'Tom',
        jods: 'Tom',
        phone: '123131231',
    },
    {
        username: 'Tom',
        jods: 'Tom',
        phone: '123131231',
    },
]
</script>
<template>
    <div class="common-layout">
        <el-container>
            <el-header>Header</el-header>
            <el-main>

                <el-card>

                    <div class="card-header">
                        <span>文章管理</span>
                        <el-button type="primary">发布文章</el-button>
                    </div>
                    <div style="margin-top: 30px;">
                        <hr>
                    </div>
                    <el-form :inline="true" :model="formInline" class="demo-form-inline">
                        <el-form-item label="用户名">
                            <el-input v-model="formInline.user" placeholder="请输入用户名" clearable />
                        </el-form-item>
                        <el-form-item label="职业">
                            <el-select v-model="formInline.region" placeholder="请选择" clearable>
                                <el-option label="teath" value="teath" />
                                <el-option label="student" value="student" />
                            </el-select>
                        </el-form-item>

                        <el-form-item>
                            <el-button type="primary" @click="onSubmit">搜索</el-button>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="default" @click="onSubmit">重置</el-button>
                        </el-form-item>
                    </el-form>

                    <el-table :data="tableData" style="width: 100%">
                        <el-table-column prop="username" label="用户名" />
                        <el-table-column prop="jods" label="工作" />
                        <el-table-column prop="phone" label="电话号码" />
                        <el-table-column label="操作" width="180">
                            <div>
                                <el-button type="primary" :icon="Edit" circle />
                                <el-button type="danger" :icon="Delete" circle />
                            </div>

                        </el-table-column>

                    </el-table>

                    <el-pagination class="el-p" v-model:current-page="currentPage4" v-model:page-size="pageSize4"
                        :page-sizes="[5, 10, 15, 20]" :size="size" :disabled="disabled" :background="background"
                        layout="jumper,total, sizes, prev, pager, next" :total="total" @size-change="handleSizeChange"
                        @current-change="handleCurrentChange" />



                </el-card>

            </el-main>
        </el-container>
    </div>
</template>
<style scoped>
.el-p {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.demo-form-inline .el-input {
    --el-input-width: 220px;
}

.demo-form-inline .el-select {
    --el-select-width: 220px;
}

.card-header {
    display: flex;
    justify-content: space-between;
}
</style>